/*
 * @Descripttion:
 * @version:
 * @Author: mmzhang
 * @Date: 2021-07-27 16:02:34
 * @LastEditTime: 2023-02-17 14:58:54
 */
import table from '@/components/dt/table/render.js'
import Opt from '@/components/dt/info/Opt.js'
let _this = null
class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [
      {
        field: 'orgDivisionName',
        title: '所属事业部',
        minWidth: 150
      },
      {
        field: 'orgCompanyName',
        title: '所属子公司',
        minWidth: 150
      },
      {
        field: 'orgOfficeName',
        title: '所属事业处',
        minWidth: 150
      },
      {
        field: 'exceptionMsg',
        title: '异常信息',
        minWidth: 180,
        header: {
          filter: {
            title: '异常信息',
            key: 'exceptionId',
            placeholder: '请输入',
            select: {
              options: [
                {
                  key: '1',
                  value: '责任人未设置'
                },
                {
                  key: '2',
                  value: '责任人已禁用'
                },
                {
                  key: '3',
                  value: '责任人无积分归属组织'
                }
              ]
            }
          }
        },
        slots: {
          default: (params, h) => {
            return [
              h(
                'div',
                {
                  style: {
                    color: params.row.exceptionId == 1 ? '#ed4014' : '#515a6e'
                  }
                },
                params.row.exceptionMsg
              )
            ]
          }
        }
      },
      {
        field: 'userName',
        title: '任务责任人',
        minWidth: 150,
        slots: {
          default: (params, h) => {
            return [
              h(
                'div',
                {
                  style: {
                    color: params.row.exceptionId == 1 ? '#ed4014' : '#515a6e'
                  }
                },
                `${params.row.userName}${
                  params.row.workNo ? params.row.workNo : '-'
                }`
              )
            ]
          }
        }
      }
    ]
  }
}

export default Column
